package news.dao;


import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;


import java.util.List;
import java.util.Map;

@Repository
@Mapper
public interface ChartDao {


    @Select("select type from news_type")
    List<String> findtypeName();


    @Select("select count(n.id) from news_type nt left join news_info n on nt.id = n.type_id group by nt.type")
    List<Integer> countType();

    @Select("select count(n.id) value,nt.type name from news_type nt left join news_info n on nt.id = n.type_id group by nt.type")
    List<Map<String, Integer>> find();
}
